/*
 @描述：该方法为收藏页面分页选择显示条数和到那一页的js代码
 @创建人：chenhao
 @创建时间：2015年7月8号 
 */

var hasAppendPageObj = false;
function forwardPage(currentPageNumber,pageSize,variable){
	useSearchFormForPage(currentPageNumber,pageSize,variable);
}

function useSearchFormForPage(currentPageNumber,pageSize,variable){
	var searchFormObj = $("#searchForm");
	if(hasAppendPageObj){
		$("#currentPageNumber").val(currentPageNumber);
		$("#pageSize").val(pageSize);
		if("search"==variable){
			$("#type").val($("#returnType").val());
			$("#keyword").val($("#returnKeyword").val());
		}
	}else{
		searchFormObj.append(getHiddenObj("currentPageNumber","currentPageNumber",currentPageNumber));
		searchFormObj.append(getHiddenObj("pageSize","pageSize",pageSize));
		if("search"==variable){
		searchFormObj.append(getHiddenObj("type","type",$("#returnType").val()));
		searchFormObj.append(getHiddenObj("keyword","keyword",$("#returnKeyword").val()));
		}
		hasAppendPageObj = true;
	}	
	searchFormObj.submit();
}

function getHiddenObj(objId,objName,objValue){
	return jQuery("<input type=\"hidden\" id=\""+objId+"\" name=\""+objName+"\" value=\""+objValue+"\" />");
}

